<template>
  <div>
    <el-table
      ref="table"
      :max-height="maxTableHeight"
      class="qualificationTab"
      :data="currentItems"
      v-loading="loading"
      size="mini"
      border
      @selection-change="selectionChange"
      @sort-change="sortItems"
      stripe
      style="width: 100%;">
      <el-table-column
        type="index"
        label="序号"
        width="56"/>
      <!-- <el-table-column
        prop="cerNews"
        label="证照信息"
        width="90">
        <a href="">下载</a>
      </el-table-column> -->
      <el-table-column
        prop="type"
        show-overflow-tooltip
        label="产品包编码"
        width="200"/>
      <el-table-column
        prop="productNameCN"
        show-overflow-tooltip
        label="产品名称(中)"
        width="200"/>
      <el-table-column
        prop="productNameEN"
        show-overflow-tooltip
        label="产品名称(英)"
        width="200"/>
      <el-table-column
        prop="registrationNumber"
        show-overflow-tooltip
        label="手术类型"
        width="200"/>
      <el-table-column
        prop="registrantName"
        show-overflow-tooltip
        label="病例描述1"
        width="200"/>

      <el-table-column
        prop="expireDate"
        show-overflow-tooltip
        label="病例描述2"
        width="200"/>
      <el-table-column
        prop="status"
        show-overflow-tooltip
        label="创建人"
        width="200"/>
      <el-table-column
        prop="approvalDate"
        show-overflow-tooltip
        label="创建时间"
        width="200"/>
      <el-table-column
        prop="approvalDate"
        show-overflow-tooltip
        label="产品总数量"
        width="200"/>
      <el-table-column
        prop="approvalDate"
        show-overflow-tooltip
        label="启用"
        width="200"/>
      <el-table-column
        prop="approvalDate"
        show-overflow-tooltip
        label="备注"
        width="200"/>

      <el-table-column
        fixed="right"
        label="操作"
        width="100">
        <template slot-scope="scope">
          <el-button
            @click="view(scope.row)"
            type="text"
            class="texBtn"
            size="small">查看</el-button>
          <el-button
            @click="deletes(scope.row)"
            type="text"
            class="dangerBtn"
            size="small">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <el-pagination
      align="right"
      style="margin-top:20px;"
      @size-change="sizeChange"
      :page-sizes="PAGE_NUMBER"
      :page-size="page.size"
      :current-page="page.page"
      @current-change="pageChange"
      :layout="PAGINATION_LAYOUT"
      :total="page.total"/>
  </div>

</template>

<script>
import paginationMixin from '@mixins/paginationMixin.js'
import { PAGINATION_LAYOUT, PAGE_NUMBER } from '@const/common'
import { registrationDocList } from '@const/api'

export default {
  name: 'ProducPackagetTable',
  mixins: [paginationMixin],
  data () {
    return {
      PAGE_NUMBER, // 页码
      PAGINATION_LAYOUT // 分页功能
    }
  },
  props: {
    productPackageList: {
      type: Array,
      default: () => ([])
    },
    pageTotal: {
      type: Number,
      default: 0
    },
    loading: {
      default: true,
      type: Boolean
    }
  },
  created () {
    this.getItems()
  },
  methods: {
    getItems () {
      this.currentItems = this.productPackageList
      this.page.total = this.pageTotal
    },
    view (data) {
      //
    },
    deletes (data) {
      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$message({
          type: 'success',
          message: '删除成功!'
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    }
  }
}
</script>

<style lang="less" scoped>
@import '../../assets/var.less';

.texBtn {
  color: @themeBlue;
}

.dangerBtn {
  color: @themeRed;
}
</style>
